# import os
# print(os.getcwd())

# import os
# print(os.path.abspath("message.txt"))

# file = open(os.path.abspath("message.txt"))
# print(file.read())

# import os
# print(os.path.exists("/Users/putao/Desktop/git/python"))

# import os
# path = "/Users/putao/Desktop/git/python/test"
# if not os.path.exists(path):
#   os.mkdir(path)
#   print('目录已创建')
# else:
#   print('该目录已存在')

# 10.2.2 删除目录
# import os
# path = "/Users/putao/Desktop/git/python/test/a/b/c"
# if os.path.exists(path):
#   os.rmdir(path)
#   print("删除成功!")
# else:
#   print("该目录不存在!")

# 删除不为空的目录
# import shutil
# path = "/Users/putao/Desktop/git/python/test/a/b"
# shutil.rmtree(path)

#10.2.6 遍历目录
import os
path = "/Users/putao/Desktop/git/python/chapter"
tuples = os.walk(path, topdown=True)
for tuple1 in tuples:
  print(tuple1,"\n")
